#!/bin/sh

# 1添加分区
sql1="
ALTER TABLE jtp_oms.oms_coupon ADD IF NOT EXISTS PARTITION (dt = '${data_date}') ;
"

# 2执行语句
/opt/module/spark/bin/beeline -u jdbc:hive2://node101:10001 -n bwie -e "${sql1}"

# 1添加分区
sql2="
ALTER TABLE jtp_oms.oms_coupon_use ADD IF NOT EXISTS PARTITION (dt = '${data_date}') ;
"

# 2执行语句
/opt/module/spark/bin/beeline -u jdbc:hive2://node101:10001 -n bwie -e "${sql2}"


# 1添加分区
sql3="
ALTER TABLE jtp_oms.oms_order ADD IF NOT EXISTS PARTITION (dt = '${data_date}') ;
"

# 2执行语句
/opt/module/spark/bin/beeline -u jdbc:hive2://node101:10001 -n bwie -e "${sql3}"


# 1添加分区
sql4="
ALTER TABLE jtp_oms.oms_order_item ADD IF NOT EXISTS PARTITION (dt = '${data_date}') ;
"

# 2执行语句
/opt/module/spark/bin/beeline -u jdbc:hive2://node101:10001 -n bwie -e "${sql4}"


# 1添加分区
sql5="
ALTER TABLE jtp_oms.ums_member ADD IF NOT EXISTS PARTITION (dt = '${data_date}') ;
"

# 2执行语句
/opt/module/spark/bin/beeline -u jdbc:hive2://node101:10001 -n bwie -e "${sql5}"